<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home></home>
  </div>

  <template id="tpl">
    <div>
      <h2>我是home页 爹</h2>
      
      <common-head ></common-head>
    </div>
  </template>

  <script src="./vue.js"></script>
  <script>
    const CommonHead = {
      template:`
        <div>
          儿子
        </div>
      `,
      data(){
        return {
          msg:"我是儿子"
        }
      },
      mounted() {
        console.log(this.$parent)
      }
    }

    const Home = {
      template:"#tpl",
      data(){
        return {
          msg:'我是爹'
        }
      },
      mounted() {
        console.log(this.$children)
      },
      components:{
        CommonHead
      }
    }
    Vue.component('Home', Home)
  
    const vm = new Vue({
      el:'#app'
    })
  </script>
</body>
</html>